#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<string.h>

int main()
{
	int n;
	scanf("%d", &n);
	int big = 0;
	int sma = 0;
	int fig = 0;
	while (n--) {
		char str[101];
		
		scanf("%s",str);
		int len = strlen(str);
		if (len < 8)
		{
			printf("NO\n");
			continue;
		}
		for (int i = 0; i < len; i++)
		{
			if (str[0] <= '9' && str[0] >= '0')
				break;
			if (str[i] >= 'a' && str[i] <= 'z')
				sma++;
			else if (str[i] >= 'A' && str[i] <= 'Z')
				big++;
			else if (str[i] >= '0' && str[i] <= '9')
				fig++;
			else
			{
				printf("NO\n");
				continue;
			}
		}
		if ((big != 0 && sma != 0) || (big != 0 && fig != 0) || (sma != 0 && fig))
			printf("YES\n");
		else
			printf("NO\n");

	}

	return 0;
}